<div id="divFormAdd">
   
<div class="demo" style="height:100%">

<div id="tabs"  style="height:100%;display:none">
    <ul>
        <li><a href="ajax/content1.html" onclick="xajax_includeFile('tinh co');">Tab 1</a></li>
    </ul>
     
            
    </div>

<script language="javascript" src="script/js.const.js" >
</script>

    
<script language="javascript">

 function initTable(){
     
     $("#tableOne").tablesorter({ debug false, sortList [[0, 0]], widgets ['zebra', 'columnHighlight'] })
                .tablesorterPager({ container $("#pagerOne"), position:fixed false });
     
 }
 
function fn_changePowerType(type_id){
    xajax_loadPower(type_id);
}
function changMode(value){
    if(value==1){
      $('#AddType').css('display','none'); 
      $('#SearchType').css('display',''); 
    }else{
      $('#AddType').css('display',''); 
      $('#SearchType').css('display','none');   
    }
}
function SaveUser(){
    var arrParams = new Array();
    arrParams['txtAddUsername']=$.trim($('#txtAddUsername').val());
    arrParams['txtPassword']=$.trim($('#txtPassword').val());
    arrParams['cmbPowerType']=$.trim($('#cmbPowerType').val());
    arrParams['cbbRoles']=$.trim($('#cbbRoles').val());
    arrParams['txtEmail']=$.trim($('#txtEmail').val());
    arrParams['cmbCity']=$.trim($('#cmbCity').val());
    arrParams['txtAddress']=$.trim($('#txtAddress').val());
    arrParams['txtPhone']=$.trim($('#txtPhone').val());
    arrParams['chkActive']=$('#chkActive').attr('checked')?10;
    xajax_SaveUser(arrParams);
}
function ActiveItem(id){
    xajax_ActiveItem(id);
}
function changeStatus(id){
   if($('#imgactive'+id).attr('title')=='Bỏ kích hoạt'){
      $('#imgactive'+id).attr('src','images/icons/icon-deactivated.gif') ;
      $('#imgactive'+id).attr('title','Kích hoạt') ;
   }else{
      $('#imgactive'+id).attr('src','images/icons/icon-active.gif') ;
      $('#imgactive'+id).attr('title','Bỏ kích hoạt') ; 
   }
}
//xajax_ajxLoadDataUser();
</script>


    </div>    

   
<div class="demo" style="height:100%">

<div id="tabs2"  style="height:100%;display:none;">
    <ul>

        <li><a href="ajax/content2.html" >Tab 1</a></li>
    <li><a href="../modules/main_users.php" >Tab 2</a></li>
        <li><a href="#tabs-3" >Tab 3 (slow)</a></li>
        <li><a href="ajax/content4-broken.php" >Tab 4 (broken)</a></li>
    </ul>
     
            
    </div>

    


</div>



<div class="divGrid" id="divGrid">

</div>

</div>

<script language="javascript">

 function initTable(){
     
     $("#tableOne").tablesorter({ debug false, sortList [[0, 0]], widgets ['zebra', 'columnHighlight'] })
                .tablesorterPager({ container $("#pagerOne"), position:fixed false });
     
 }
 
function fn_changePowerType(type_id){
    xajax_loadPower(type_id);
}
function changMode(value){
    if(value==1){
      $('#AddType').css('display','none'); 
      $('#SearchType').css('display',''); 
    }else{
      $('#AddType').css('display',''); 
      $('#SearchType').css('display','none');   
    }
}
function SaveUser(){
    var arrParams = new Array();
    arrParams['txtAddUsername']=$.trim($('#txtAddUsername').val());
    arrParams['txtPassword']=$.trim($('#txtPassword').val());
    arrParams['cmbPowerType']=$.trim($('#cmbPowerType').val());
    arrParams['cbbRoles']=$.trim($('#cbbRoles').val());
    arrParams['txtEmail']=$.trim($('#txtEmail').val());
    arrParams['cmbCity']=$.trim($('#cmbCity').val());
    arrParams['txtAddress']=$.trim($('#txtAddress').val());
    arrParams['txtPhone']=$.trim($('#txtPhone').val());
    arrParams['chkActive']=$('#chkActive').attr('checked')?10;
    xajax_SaveUser(arrParams);
}
function ActiveItem(id){
    xajax_ActiveItem(id);
}
function changeStatus(id){
   if($('#imgactive'+id).attr('title')=='Bỏ kích hoạt'){
      $('#imgactive'+id).attr('src','images/icons/icon-deactivated.gif') ;
      $('#imgactive'+id).attr('title','Kích hoạt') ;
   }else{
      $('#imgactive'+id).attr('src','images/icons/icon-active.gif') ;
      $('#imgactive'+id).attr('title','Bỏ kích hoạt') ; 
   }
}
//xajax_ajxLoadDataUser();
</script>

<script language="javascript" src="script/js.const.js" >
</script>

<script language="javascript">

var _global;
 $(document).ready(function(){
//    _global=new Global();
//    _global.gMap=new GoogleFuncs();
//    _global.myMap=_global.gMap;
//    _global.checkMap=0;// 1VBD truoc,0 google map
//    $('#hdDrawMarker').val(1);    
//     _global.gMap.InitMap('maptracking2'); 
      initTable();       
 });
 
 function initTable(){
     
     $("#tableOne").tablesorter({ debug false, sortList [[0, 0]], widgets ['zebra', 'columnHighlight'] })
                .tablesorterPager({ container $("#pagerOne"), position:fixed false });
     
 }

     
 function setTable(value){
     
       $('#trbutton').css('display','');
     if(value==1){
         $('#hdtable').val('tbl_city');
         $('#trCity').css('display','');
         $('#trProvince1').css('display','none');
         $('#trProvince2').css('display','none');
         $('#trWard1').css('display','none');
         $('#trWard2').css('display','none');
         $('#trWard3').css('display','none');
         xajax_ajxLoadDataCity();
     }else if(value==2){
         $('#hdtable').val('tbl_province');
         $('#trCity').css('display','none');
         $('#trProvince1').css('display','');
         $('#trProvince2').css('display','');
         $('#trWard1').css('display','none');
         $('#trWard2').css('display','none');
         $('#trWard3').css('display','none');
         var param = new Array();
         if($('#cmbCity1').val()!=-1){
            param['city_id'] = $('#cmbCity1').val();  
         }
         xajax_ajxLoadDataProvince(param);  
     }else if(value==3){
         $('#hdtable').val('tbl_ward');
         $('#trCity').css('display','none');
         $('#trProvince1').css('display','none');
         $('#trProvince2').css('display','none');
         $('#trWard1').css('display','');
         $('#trWard2').css('display','');
         $('#trWard3').css('display','');
                  xajax_ajxLoadDataWard();  
         
     }else{
         $('#trbutton').css('display','none');
         $('#trCity').css('display','none');
         $('#trProvince1').css('display','none');
         $('#trProvince2').css('display','none');
         $('#trWard1').css('display','none');
         $('#trWard2').css('display','none');
         $('#trWard3').css('display','none');
         xajax_ajxLoadDataCity();
     }
 }

function SaveFormAdd(oform){
    var params = new Array();
    var elem = oform.elements;
    var flength = elem.length;    
    for(i=0;i<flength;i++){    
        if(elem[i].type !='button'&&elem[i].type !='reset'){
            params[elem[i].id]=elem[i].value;
        }
    }
    params['hdSaveStatus']=$('#hdSaveStatus').val();
    params['hdSaveId']=$('#hdSaveId').val();
    params['hdtable']=$('#hdtable').val();
    xajax_SaveFormAdd(params);    
}
function DeleteData(){
        var arID = new Array();
        var i = 0;
        $('INPUT[name=chkDelete]').each(function(){
            if($(this).attr('checked'))
            {
                arID[i] = $(this).attr('id');
                i++;
            }
        });
        var table = $('#hdtable').val();
        xajax_DeleteData(arID,table);        
}
function deletea(id){
     tmpObj = document.getElementById(id);
    tmpObj.style.display = "none";
}

$('#cmbCity2').change(function() {
      var param = new Array();
      xajax_ajxLoadProvince($('#cmbCity2').val());
      param['city_id']=$(this).val();
      xajax_ajxLoadDataWard(param);
});

$('#cmbCity1').change(function() {
    var param = new Array();
    param['city_id']=$(this).val();
    xajax_ajxLoadDataProvince(param);
          
});
function loadWard(id){
    var param = new Array();
    param['province_id']=id;
    xajax_ajxLoadDataWard(param); 
}


xajax_ajxLoadDataCity();
//var cal1 = CreateCalObject('txtFromDate', 'imgCal1');
//var cal2 = CreateCalObject('txtToDate', 'imgCal2');
</script>

<script>
    $(function() {
          $( "#tabs2" ).tabs({
            ajaxOptions {
                error function( xhr, status, index, anchor ) {
                    $( anchor.hash ).html(
                        "Couldn't load this tab. We'll try to fix this as soon as possible. " +
                        "If this wouldn't be a demo." );
                }
            }
        });
    });

    </script>


<script language="javascript">
function addDiv(){
    $('#divFormAdd').html('<div id="tabs3"  style="height:100%;"><ul><li><a href="ajax/content1.html" >keke</a></li><li><a href="../modules/main_users.php" >123456</a></li><li><a href="#tabs-3" >Tab 3 (slow)</a></li>     <li><a href="ajax/content2.html" >Tab 4 (broken)</a></li></ul></div>');
    changeTab('tabs3');
}
</script>

<script>
    $(function() {
        $( "#tabs" ).tabs({
            ajaxOptions {
                error function( xhr, status, index, anchor ) {
                    $( anchor.hash ).html(
                        "Couldn't load this tab. We'll try to fix this as soon as possible. " +
                        "If this wouldn't be a demo." );
                }
            }
        });
    });
    </script>

